# Copyright 2023 The Horizoncd Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# ==============================================================================
# Makefile helper functions for generate necessary files and docs
# https://cloud.redhat.com/blog/kubernetes-deep-dive-code-generation-customresources
# ! The stock of code generated by `make gen` should be idempotent
#

## gen.run: gen.code gen.docgo
.PHONY: gen.run
gen.run: gen.code gen.docgo

## gen.code: generate code
.PHONY: gen.code
gen.code: tools.install.mockgen
	@echo "===========> Generating codegen"
	@$(GO) generate ./...

## gen.docgo: generate doc.go
.PHONY: gen.docgo
gen.docgo:
	@echo "===========> Generating doc.go"

## gen.help: show help for gen
.PHONY: gen.help
gen.help: scripts/make-rules/gen.mk
	$(call smallhelp)
